|
|
|
|
|
|
|
A command button control is used when you want the user to perform some action on a form. The action may be to close the form, save information on the form, or call another form. The user can click the command button with the mouse or tab to the command button and press the spacebar. Once the command button is clicked, it will generate an event. You can write code in that event to perform an appropriate action. Youll learn how to write code that responds to events in Chapter 5, Events Happen. |
|
|
|
|
ADDITIONAL NOTES ON THE TEXT BOX If you want to verify that the user has entered a minimum amount of characters into a text box, you have to write some code to test for this. You would enter this code in either the KeyPress, KeyDown, or KeyUp events. If you want to create a password-type text box, you can set the PasswordChar property to an asterisk (*) or to any other character you want. When the user types, only that character will show up in the text box, but the Text property will be set to the actual letters the user types in. |
|
|
|
|
|
|
Command Button Common Properties |
|
|
|
|
|
|
|
|
Command button controls have very few properties you need to be concerned with. Table 3.6 is a list of the most commonly changed properties for a command button control. |
|
|
|
|
| Table 3.6 Command Button Properties. | | Property | Description | | Cancel | When you set this property to a True value, it generates its Click event when the user presses the Esc key. Only one command button on the form may have this property set to True. | | Caption | Set this property to the text you want to display on the command button. If you place an ampersand (&) before a letter in the caption, youll create an underscore under that letter. The user can press the Alt key in combination with that letter to have the Click event fire for this command button. |
|
|
|
|
|
|
(table continued on next page) |
|
|
|
|
|